cmake_minimum_required(VERSION 3.22)

# gtk 示例构建
# gtk_add_example [...dir]
macro(gtk_add_example)
    set(GTK_EXAMPLE ${ARGN})
    foreach(e IN LISTS GTK_EXAMPLE)
        
        find_plus_v(e e_p)
        if(e_p LESS 0)
            spark_add_executable_path(${e} ${e})
            target_link_gtkutils(${e})
        else()
            str_right_v(e e_p target)
            str_left_v(e e_p e)

            spark_add_executable_path(${e} ${e})
            target_link_gtkutils(${e})

            string(REPLACE "+" ";" target "${target}")
            target_link_libraries(${e} ${target})
        endif(e_p LESS 0)
        

        # target_link_libraries(${e} PRIVATE $<TARGET>)
    endforeach(e IN LISTS GTK_EXAMPLE)
endmacro(gtk_add_example)

# 被注释部分 - usegtk4
gtk_add_example(
    gtk-adb-mamanger+baseutils
    # gtk-base
    # gtk-base-new
    # gtk-base-new-final
    gtk-boxAppend-test
    gtk-brew-services+baseutils
    gtk-changelog
    gtk-chat+baseutils+pthread
    gtk-cmake-build+baseutils
    gtk-cmake-bundle-generator+baseutils
    # gtk-code-snippets
    gtk-desktop-generator
    # gtk-hello-word-test
    gtk-helloworld
    gtk-helloworld-in-c
    gtk-image-file-test
    gtk-instruction-generater
    # gtk-json-test+baseutils+cjsonutils
    gtk-login-panel-test
    # gtk-network-config+linuxutils+cjsonutils
    gtk-other-test+baseutils
    gtk-simple-hello-word+baseutils
    gtk-sshto-expect+baseutils
    gtk-switch-food-test+baseutils
    gtk-system-info-test+baseutils+linuxutils
    gtk-timeout-network-setting-test+baseutils+cjsonutils+other
    # gtk-timeout-system-info-test+linuxutils
)

if(USE_GTK4)
    gtk_add_example(
        gtk-base
        gtk-base-new
        gtk-base-new-final

        gtk-json-test+baseutils+cjsonutils
        gtk-network-config+linuxutils+cjsonutils
        gtk-timeout-system-info-test+linuxutils
    )
endif(USE_GTK4)
